<?php
namespace Home\Model;
use Think\Model;
class OrderModel extends Model {
    public function getOrderList($cond){
    	if(!$cond){
    		return false;
    	}
    	$res = M('order')->join('ecm_member on ecm_order.buyer_id = ecm_member.user_id')
            ->join('ecm_store on ecm_member.s_id = ecm_store.store_id')
            ->join('ecm_order_goods on ecm_order.order_id = ecm_order_goods.order_id ')
            ->where($cond['condition'])
            ->limit($cond['page'])
            ->field($cond['field'])
            ->select();
    	return $res;
    }
    public function getSalesCount($cond){
        if(!$cond){
            return false;
        }
        $res = M('order')->field("count(*) as sum,FROM_UNIXTIME(pay_time, '%Y-%m-%d') as date")
            ->group('date')
            ->where($cond)
            ->select();

        return $res;
    }
}